import { createRouter, createWebHistory, Router, RouteRecordRaw } from 'vue-router';
import routes from './routes';

// 路由打平处理
// const routerFomart = (routers: RouteRecordRaw[]) => {
//   const result = routers

//   if (routers.length >= 1) {
//     const temp: RouteRecordRaw[] = []
//     routers.forEach((router: RouteRecordRaw) => {
//       // 是否有children

//       // 是否有keepAlive
//       // router.children?.forEach()
//     })
//   }

//   return result
// }

const router: Router = createRouter({
  history: createWebHistory('/'),
  routes: routes,
});

router.beforeEach(async (_to, _from, next) => {
  next();
});

export default router;
